<template>
  <div id="app">
    <!-- <transition name="route"> -->
    <router-view />
    <!-- </transition> -->
    <bar></bar>
  </div>
</template>

<script>
// import Loading from '@/base/loading/loading';
import Bar from "base/bar/bar";

export default {
  name: "App",
  components: { Bar },
  mounted() {
    var u = navigator.userAgent;
    var ws;
    var flag;
    var myFunction;
    var isAndroid = u.indexOf("Android") > -1 || u.indexOf("Adr") > -1; //android终端
    var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
    if (isIOS ) {
      document.body.addEventListener("focusin", () => {
        //软键盘弹起事件
        flag = true;
        clearTimeout(myFunction);
      });
      document.body.addEventListener("focusout", () => {
        //软键盘关闭事件
        flag = false;
        ws =
          document.body.scrollTop == 0
            ? document.documentElement.scrollTop
            : document.body.scrollTop;
        if (!flag) {
          myFunction = setTimeout(function() {
            window.scrollTo({ top: ws, left: 0, behavior: "smooth" });
          }, 200);
        } else {
          return;
        }
      });
    } else {
      return;
    }
  }
};
</script>

<style lang="scss" scoped>
@import "~common/scss/var.scss";
.route-enter {
  opacity: 0.2;
  // transform: translate3d(0, 0, 0);
}
.route-enter-active {
  transition: $transitionFast;
}
.route-leave-active {
  transition: $transitionFast;
}
.route-leave-to {
  // transform: translateY(50px);
  transform: translate3d(0, 150px, 0);
  opacity: 0;
}
</style>

